package com.example.springclouduserserver1020.controller;

import com.example.springcloudusercommon.entity.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 温伟雄
 * @Date: 2021/10/12/15:01
 * @Description:
 */
@RestController
public class UserController {

    //读取配置文件的端口
    @Value("${server.port}")
    private String port;

    //订单服务来调用这个方法      http://localhost:1020/user/10
    // @GetMapping(value = "/user/{id}" )
    @RequestMapping(value = "/user/{id}",method = RequestMethod.GET)
    public User getById(@PathVariable("id")Long id){
        //根据id去数据库查询User

        return  new User(id,"zs:"+id,"我是zs,port:"+port);
    }

}
